<script setup lang="ts">
import { Button as VanButton } from "vant";
// import {useUserStore} from "@/stores/modules/user";
import { useUserStore } from '@/stores/index.ts'

import {request} from '@/utils/request'


const userStore = useUserStore()



// 测试请求拦截器

const getUserInfo = async ()=>{
  // /inthepink/myUser

  const res = await request('/inthepink/myUser','get')
  console.log(res);
  
}

// 测试响应拦截器

const store = useUserStore()
const login = async ()=>{
  const res = await request<User>('/login/password','POST',{
    password:'123456',
    mobile:'15244667237'
  })

  store.setUser(res)
  console.log(user);
  
}


</script>

<template>
  <p>★{{ userStore.user }}</p>

  <button @click="userStore.setUser({id:'1',mobile:'15244667237',account:'jack',avatar:'123',token:'qwertyuiop'})">添加user信息</button>
  <!-- <van-button>大按钮</van-button> -->

  <van-button @click="getUserInfo">获取用户信息</van-button>
  <van-button @click="login">登陆</van-button>
</template>

<style scoped>

</style>
